var nav = document.getElementsByTagName("nav");

$(window).scroll(function(){
	var scrollheight = $(window).scrollTop();
	if(scrollheight >= 40){
		nav.style.position ="fixed";
		nav.style.top = 0;
		
		// nav.classList.add():鍦ㄥ師鏉ョ殑鍩虹涓婏紝鍐嶆坊鍔犱竴涓猚lass
        // nav.classList.add('fixed-top')
	}
	else{
		nav.style.position = "static";
		// 鍒犻櫎涓€涓猚lass 
		// nav.classList.remove('fixed-top');
	}
})
